const path = require('path')
const axios = require(path.join(__dirname,"api"))

/**
 * 返回分类树
 */
exports.getCategoryTree =  () => {
    return axios.get(`categories?format=tree`).then(res=>res.data).catch(err=>Promise.reject(err))
}

/**
 * 获取分类的上一级及上上级
 */
exports.getCategoryParent = (cateId) => {
    return axios.get(`categories/${cateId}?include=parent`).then(res=>res.data).catch(err=>Promise.reject(err))
}